#include "../Callback.h"
#include "../Callback_Handler.h"
#include <iostream>
using namespace std;

int myprintf2( int a, int b )
{
	cout << a <<endl;
	cout << b <<endl;
	return 100;
}
int myprintf1( int a )
{
	cout << a <<endl;
	return 100;
}

int myprintf3( int a, int b, int c )
{
	cout << a <<endl;
	cout << b <<endl;
	cout << c <<endl;
	return 100;
}

int myprintf4( int a, int b, int c, int d )
{
	cout << a <<endl;
	cout << b <<endl;
	cout << c <<endl;
	cout << d <<endl;
	return 100;
}

int myprintf5( int a, int b, int c, int d, int e )
{
	cout << a <<endl;
	cout << b <<endl;
	cout << c <<endl;
	cout << d <<endl;
	cout << e <<endl;
	return 100;
}

int myprintf6( int a, int b, int c, int d, int e, int f )
{
	cout << a <<endl;
	cout << b <<endl;
	cout << c <<endl;
	cout << d <<endl;
	cout << e <<endl;
	cout << f <<endl;
	return 100;
}

int myprintf0()
{
	cout << "0" <<endl;
	return 0;
}

template<int T>
class placeholder
{};


int myprintf7( int a, int b, int c, int d, int e, int f, placeholder<7>  )
{
	cout << a <<endl;
	cout << b <<endl;
	cout << c <<endl;
	cout << d <<endl;
	cout << e <<endl;
	cout << f <<endl;
	//cout << _1 <<endl;
	return 100;
}
#include <list>



int main()
{
	list<CallbackHandlerBase *> handlers;
	placeholder<7> _7;
	handlers.push_back( bind_handler( &myprintf0 ) );
	handlers.push_back( bind_handler( &myprintf1, 1 ) );
	handlers.push_back( bind_handler( &myprintf2, 2, 2 ) );
	handlers.push_back( bind_handler( &myprintf3, 3, 3, 3 ) );
	handlers.push_back( bind_handler( &myprintf4, 4, 4, 4, 4 ) );
	handlers.push_back( bind_handler( &myprintf5, 5, 5, 5, 5, 5 ) );
	handlers.push_back( bind_handler( &myprintf6, 6, 6, 6, 6, 6, 6 ) );
	handlers.push_back( bind_handler( &myprintf7, 7, 7, 7, 7, 7, 7, _7 ) );
	for( list<CallbackHandlerBase*>::iterator iter = handlers.begin();
		iter != handlers.end();
		++iter )
		(*iter)->invoke();

}